<?php
require 'common.inc.php';
require DT_ROOT.'/api/weixin/init.inc.php';
$url = 'https://api.weixin.qq.com/cgi-bin/user/get?access_token='.$access_token.'&next_openid='.$next_openid;
//echo "url =>".$url.'<br>';
//遍历获取所有用户信息
$result = $db->query("SELECT * FROM {$DT_PRE}weixin_user where pushstatus=3 or pushstatus=4  ORDER BY itemid ");
$curr_time = time();
sleep(rand(0,10));
if($db->affected_rows($result)) {
    while($user = $db->fetch_array($result)) {
		$pushlist = pushlist_weixin($user,$curr_time);         //获取推送的查询列表
		send_wxs($DT['push_wx_filename'],count($pushlist));
			
           

    }
}


function send_wxs($filename,$zs) {
	
    global $wx;
    global $access_token;
    global $DT;
    global $MODULE;
    global $user;
    $CAT_TENDER = cache_read('category-23.php');
    //TODO 测试用access_token 覆盖全局access_token
//    $access_token = 'Ng-HUdMaM69drYOBQ6zTLk7FNgKnQlh0xO05eWdBy-BL9_Sws9oF6MOpmzHMNWVhIROfeFjDlVvN8IYlvvSP6Z6m5aSETP6gQrB0wSfTYnMMGYeACAUOG';
//    $openid = 'ow8N8twanbFgcp3xorKmZBkiGf_M'; //TODO 测试用的openid;

    $data = array();
    $data['first'] = array('value'=>"您有新的招标信息！",'color'=>'#173177');
//    $data['title'] = array('value'=>"合信推送",'color'=>'#173177');
//    $data['group'] = array('value'=>"招标信息",'color'=>'#173177');
    $data['Good'] = array('value'=>"合信推送",'color'=>'#173177');
    $data['contentType'] = array('value'=>"招标信息",'color'=>'#173177');

    $str_remark = '';
	
  //$pushtest = pushlist_weixin($user);
  echo $zs;exit;
   //$pushtest1 = pushlist_weixin($user);
   //$count = 0;



}
?>
